<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>传统的注册事件</button>
    <button>事件监听注册事件</button>

    <script>
        var btn = document.querySelectorAll('button');
        //传统方式注册事件
        btn[0].onclick = function () {
            alert('hihi')
        }
        btn[0].onclick = function () {
            alert('4564')
        }
        //2.事件监听注册事件addEventListener
        //里面的事件类型是字符串 必定加引号 而且不带on
        btn[1].addEventListener('click', function () {
            alert('44')
        })
        btn[1].addEventListener('click', function () {
            alert('55')
        })



    </script>
</body>

</html>